package com.nbsaas.boot.marketing.data.entity;

import com.nbsaas.boot.code.annotation.*;
import com.nbsaas.boot.jpa.data.entity.AbstractEntity;
import jakarta.persistence.Column;
import jakarta.persistence.Entity;
import jakarta.persistence.Table;
import lombok.Data;
import org.hibernate.annotations.Comment;

import java.math.BigDecimal;

@CreateByUser
@ComposeView
@Data
@FormAnnotation(title = "会员等级", model = "会员等级")
@Entity
@Table(name = "bs_member_level")
@Comment("会员等级表")
public class MemberLevel extends AbstractEntity {

    @Comment("等级名称")
    @SearchItem(name = "name", key = "name", label = "等级名称")
    @FormField(title = "等级名称", sortNum = "1", grid = true, required = true)
    @Column(length = 100, nullable = false)
    private String name;

    @Comment("等级编码")
    @SearchItem(name = "code", key = "code", label = "等级编码")
    @FormField(title = "等级编码", sortNum = "2", grid = true)
    @Column(length = 50, unique = true)
    private String code;

    @Comment("等级数值")
    @FormField(title = "等级数值", sortNum = "3", grid = true, type = InputType.el_input_number, sort = true)
    private Integer level;

    @Comment("最低积分")
    @FormField(title = "最低积分", sortNum = "4", grid = true, type = InputType.el_input_number)
    private Integer minPoints;

    @Comment("最高积分")
    @FormField(title = "最高积分", sortNum = "5", grid = true, type = InputType.el_input_number)
    private Integer maxPoints;

    @Comment("折扣率")
    @FormField(title = "折扣率", sortNum = "6", grid = true, type = InputType.el_input_number)
    @Column(precision = 5, scale = 2)
    private BigDecimal discountRate;

    @Comment("等级图标")
    @FormField(title = "等级图标", sortNum = "7", type = InputType.image)
    @Column(length = 500)
    private String icon;

    @Comment("等级描述")
    @FormField(title = "等级描述", sortNum = "8", type = InputType.textarea, col = 23)
    @Column(columnDefinition = "text")
    private String description;

    @Comment("等级权益")
    @FormField(title = "等级权益", sortNum = "9", type = InputType.richText, col = 23)
    @Column(columnDefinition = "text")
    private String benefits;

    @Comment("状态")
    @SearchItem(name = "status", key = "status", label = "状态")
    @FormField(title = "状态", sortNum = "10", grid = true, type = InputType.select, option = "coupon_status")
    @Column(length = 20)
    private String status;
} 